<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RoadshowProject extends Model
{
    //
    protected $table = 'roadshow_project';

    protected $fillable = array('project_id', 'roadshow_apply_id');

    public $timestamps = false;

    protected function getDateFormat()
    {
        return date(time());
    }

    public function project()
    {
        return $this->hasOne('App\Models\Project', 'id', 'project_id');
    }

    /**
     * 判断项目是否存在
     *
     * @param unknown_type $project_id
     * @param unknown_type $roadshow_apply_id
     * @return boolean
     */
    static function checkRoadshowProject($project_id, $roadshow_apply_id)
    {
        $count = self::where('project_id', $project_id)->where('roadshow_apply_id', $roadshow_apply_id)->count();

        if ($count) {
            return true;
        }

        return false;
    }
}
